#pragma once
#include "CoreMinimal.h"
#include "GameplayEffectTypes.h"
#include "AuraEffectActor.generated.h" 

class UGameplayEffect;
class USphereComponent;
class UAbilitySystemComponent;
UENUM(BlueprintType)
enum class EEffectApplicationPolicy:uint8
{
	ApplyOnOverlap,
	ApplyOnEndOverlap,
	DoNotApply
};
UENUM(BlueprintType)
enum class EEffectRemovenPolicy:uint8
{
	RemoveOnEndOverlap,
	DoNotApply
};
UCLASS()
class AAuraEffectActor : public AActor
{
	GENERATED_BODY()
public:
	AAuraEffectActor();
protected:
	virtual void BeginPlay() override;
	UFUNCTION(BlueprintCallable)
	void ApplyEffectToTarget(AActor* TargetActor,TSubclassOf<UGameplayEffect> GameplayEffectClass);

	UFUNCTION(BlueprintCallable)
	void OnBeginOverlap(AActor*TargetActor);
	UFUNCTION(BlueprintCallable)
	void OnEndOverlap(AActor*TargetActor);
	
	UPROPERTY(EditAnywhere,BlueprintReadOnly,Category="GamePlayEffects")
	bool bDestroyOnEffectRemoval = false;
	
	UPROPERTY(EditAnywhere,BlueprintReadOnly,Category="GamePlayEffects")
	TSubclassOf<UGameplayEffect> InstantGameplayEffectClass;
	UPROPERTY(EditAnywhere,BlueprintReadOnly,Category="GamePlayEffects")
	EEffectApplicationPolicy InstantApplicationPolicy = EEffectApplicationPolicy::DoNotApply;
	
	UPROPERTY(EditAnywhere,BlueprintReadOnly,Category="GamePlayEffects")
	TSubclassOf<UGameplayEffect> DuationGameplayEffectClass;
	UPROPERTY(EditAnywhere,BlueprintReadOnly,Category="GamePlayEffects")
	EEffectApplicationPolicy  DuationApplicationPolicy = EEffectApplicationPolicy::DoNotApply;

	UPROPERTY(EditAnywhere,BlueprintReadOnly,Category="GamePlayEffects")
	TSubclassOf<UGameplayEffect> InfiniteGameplayEffectClass;
	UPROPERTY(EditAnywhere,BlueprintReadOnly,Category="GamePlayEffects")
	EEffectApplicationPolicy   InfiniteApplicationPolicy = EEffectApplicationPolicy::DoNotApply;
	UPROPERTY(EditAnywhere,BlueprintReadOnly,Category="GamePlayEffects")
	EEffectRemovenPolicy InfiniteRemovenPolicy = EEffectRemovenPolicy::RemoveOnEndOverlap;
	UPROPERTY(EditAnywhere,BlueprintReadOnly,Category="GamePlayEffects")
	float ActorLevel = 1.f;
private:
	TMap<FActiveGameplayEffectHandle,UAbilitySystemComponent*> ActiveEffectHandleMap;
};

